package npap.cater.unr.edu.client.managed.activity;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.requestfactory.shared.EntityProxyId;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import npap.cater.unr.edu.client.managed.request.ApplicationRequestFactory;
import npap.cater.unr.edu.client.managed.ui.FileDetailsView;
import npap.cater.unr.edu.client.managed.ui.FileEditView;
import npap.cater.unr.edu.client.managed.ui.FileListView;
import npap.cater.unr.edu.client.managed.ui.FileMobileDetailsView;
import npap.cater.unr.edu.client.managed.ui.FileMobileEditView;
import npap.cater.unr.edu.client.proxy.FileProxy;
import npap.cater.unr.edu.client.proxy.ProjectProxy;
import npap.cater.unr.edu.client.request.FileRequest;
import npap.cater.unr.edu.client.scaffold.ScaffoldApp;
import npap.cater.unr.edu.client.scaffold.place.CreateAndEditProxy;
import npap.cater.unr.edu.client.scaffold.place.FindAndEditProxy;
import npap.cater.unr.edu.client.scaffold.place.ProxyPlace;

public class FileActivitiesMapper extends FileActivitiesMapper_Roo_Gwt {

    public FileActivitiesMapper(ApplicationRequestFactory requests, PlaceController placeController) {
        this.requests = requests;
        this.placeController = placeController;
    }

    public Activity getActivity(ProxyPlace place) {
        switch(place.getOperation()) {
            case DETAILS:
                return new FileDetailsActivity((EntityProxyId<FileProxy>) place.getProxyId(), requests, placeController, ScaffoldApp.isMobile() ? FileMobileDetailsView.instance() : FileDetailsView.instance());
            case EDIT:
                return makeEditActivity(place);
            case CREATE:
                return makeCreateActivity();            
        }
        throw new IllegalArgumentException("Unknown operation " + place.getOperation());
    }
}
